package com.net.xpay.common.manager.impl;

import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.net.common.dao.BasicMapper;
import com.net.xpay.common.dao.BookAccountTransferOrderMapper;
import com.net.xpay.common.domain.BookAccountTransferOrder;
import com.net.xpay.common.manager.BookAccountTransferOrderManager;
import com.net.common.manager.AbstractManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


@Component
public class BookAccountTransferOrderManagerImpl extends AbstractManager<BookAccountTransferOrder> implements BookAccountTransferOrderManager{

    @Autowired
    private BookAccountTransferOrderMapper mapper;


    @Override
    protected BasicMapper<Long, BookAccountTransferOrder> getMapper() {
        return mapper;
    }

    @Override
    public BookAccountTransferOrder findByImportBizNo(Long userId, String importBizNo) {
        Preconditions.checkArgument(userId != null && !Strings.isNullOrEmpty(importBizNo));
        BookAccountTransferOrder condition = new BookAccountTransferOrder();
        condition.setUserId(userId);
        condition.setImportBizNo(importBizNo);
        return getByCondition(condition);
    }

    @Override
    public BookAccountTransferOrder findByOutBizNo(String outBizNo) {
        Preconditions.checkArgument(!Strings.isNullOrEmpty(outBizNo));
        BookAccountTransferOrder condition = new BookAccountTransferOrder();
        condition.setOutBizNo(outBizNo);
        return getByCondition(condition);
    }
}
